//index.js  
//获取应用实例  
var app = getApp()
Page({
  data: {
    userInfo: {},
    nickName: ''
  },
  //事件处理函数  
  bindViewTap: function () {
    wx.navigateTo({
      url: '../message/message'
    })
  },
  onShow: function () {
    var _this = this;
    wx.getStorage({
      key: "nickName",
      success: function (res) {
        console.log(res.data)
        _this.setData({
          nickName: res.data.nickName
        })
        // console.log(_this.data.nickName)
      }
    })
  },
  onLoad: function () {
    console.log('onLoad')
    var that = this
    //调用应用实例的方法获取全局数据  
    app.getUserInfo(function (userInfo) {
      //更新数据  
      that.setData({
        userInfo: userInfo
      })
    })
    
  },
  goAlbum: function(e) {
    wx.navigateTo({
      url: '../album/album',
    })
  },
  getPhoneNumber: function (e) {
    console.log(e.detail.errMsg)
    console.log(e.detail.iv)
    console.log(e.detail.encryptedData)
    if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
      wx.showModal({
        title: '提示',
        showCancel: false,
        content: '未授权',
        success: function (res) { }
      })
    } else {
      wx.showModal({
        title: '提示',
        showCancel: false,
        content: '同意授权',
        success: function (res) { }
      })
    }
  },
  goPurse: function() {
    wx.navigateTo({
      url: '../computMoney/computMoney'
    })
  }  
})  